package com.cjy;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * @author Cheng JiYe
 * @description:
 * @date 2020/6/6  12:36
 */
@ComponentScan("com.cjy")
@MapperScan("com.cjy.mapper.*")
@SpringBootApplication
@Slf4j
public class GatherApplication extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(GatherApplication.class, args);
        log.debug("启动成功");
    }

    /**
     * 支持war包部署
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(GatherApplication.class);
    }

    /**
     * 初始化RestTemplate对象，用于支持远程调用
     *
     * @return
     */
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
